accountingIntegrationDashboardApp.controller('maintenanceGlAccountKeyDetailCtrl', ['$scope', '$http', '$log', 'serverDataService', function ($scope, $http, $log, serverDataService){ 

    $scope.glAccountKeys = [];
    $scope.glElementValues = [];

    $scope.entityName = 'gl-account-key-detail';

    $scope.setChildScope($scope);

    $scope.renderRecordsFromServer();

    $scope.loadGlAccountKeys = function(){
        return $scope.glAccountKeys.length ? null : serverDataService.getEntityList('gl-account-key', false)
                .then(function (data){
                    $scope.glAccountKeys = data.gridRecords;
                });
    };

    $scope.loadGlElementValues = function(){
        return $scope.glElementValues.length ? null : serverDataService.getEntityList('gl-element-value', false)
                .then(function (data){
                    $scope.glElementValues = data.gridRecords;
                });
    };

    $scope.addGlAccountKeyDetail = function() {
        $scope.inserted = {
          id: null
        };
        $scope.gridRecords.push($scope.inserted);
    };
}]);